﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPageContent.master" AutoEventWireup="false" CodeFile="ScreenPermissions.aspx.vb" Inherits="ScreenPermissions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <br /><br />

    <table style="width:800px">
            <tr>
                <td>
                   &nbsp;&nbsp; <asp:Label ID="lblSelectUser" meta:resourcekey="lblSelectUser" runat="server" ></asp:Label>
                </td>
                <td>
                <telerik:RadComboBox ID="rcbUsers" runat="server" DataSourceID = "odsUserList" AutoPostBack="true" EnableLoadOnDemand = "true"
                    HighlightTemplatedItems="true"  Width="350px" DropDownWidth="400px" OnSelectedIndexChanged="OnSelectedIndexChangedHandler"
                    OnItemsRequested="RadComboBox1_ItemsRequested" DataTextField = "UserName" DataValueField="id" 
                    OnItemDataBound="RadComboBox1_ItemDataBound" EmptyMessage="Choose a User" SkinID="rcbSkin" ValidationGroup="valUsers" >
                            <HeaderTemplate>
                                <ul class="col">
                                <li class="col1">Employee No.</li>
                                <li class="col2">User Name</li>
                                </ul>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <ul class="col">
                                    <li class="col1">
                                        <%# DataBinder.Eval(Container.DataItem, "emp_Num")%></li>
                                    <li class="col2">
                                        <%# DataBinder.Eval(Container.DataItem, "UserName")%></li>
                                </ul>
                            </ItemTemplate>

                </telerik:RadComboBox>
                </td>
                <td>
                    &nbsp; <asp:RequiredFieldValidator ID="rfvrcbUsers" runat="server" ControlToValidate="rcbUsers" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valUsers"></asp:RequiredFieldValidator>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
               <tr>
                <td colspan="2" style="padding-left:20px;" >&nbsp;&nbsp;&nbsp;
                <telerik:RadTreeView ID="RadTreeView1" runat="server" ValidationGroup="valUsers"
                    DataValueField = "ID"
                    DataFieldID="ID" DataFieldParentID="ParentID" DataTextField="<%$ Resources:SystemResource, rcbLookup %>" 
                    CheckChildNodes="True" TriStateCheckBoxes="True"
                    DataSourceID="odsPermissions" CheckBoxes="True" 
                    OnNodeDataBound="RadTreeView1_NodeDataBound" SkinID="rtvSkin" >
                </telerik:RadTreeView>    
                </td>
                
                <td>
                    <asp:Label ID="lblIsPermitted" runat="server" meta:resourcekey="lblIsPermitted" Visible="false"></asp:Label>  
                </td>
                
            </tr>
            <tr>
                <td colspan="5" style="text-align: center">
                <asp:ImageButton ID="ibtnSave" runat="server" meta:resourcekey="ibtnSave"
                     ValidationGroup="valUsers" CausesValidation="true" />
                </td>
            </tr>
        </table>

    <%--<asp:SqlDataSource runat="server" ID="sdsUsers" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT UserTable.id, isnull(Employee.emp_Num,0) as [emp_Num], isnull(Employee.FName,'-') as [FName], isnull(UserTable.UserName,'-') as [UserName] FROM [Employee] right outer join [UserTable] ON UserTable.emp_Num = Employee.emp_Num " >
            
            <SelectParameters>
                
            </SelectParameters>

    </asp:SqlDataSource>--%>

    <asp:ObjectDataSource ID="odsUserList" runat="server" 
    DeleteMethod="QueryDatabase" InsertMethod="QueryDatabase" 
    SelectMethod="QueryDatabase" TypeName="UserSP" 
    UpdateMethod="QueryDatabase" >
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvUsersList" Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="emp_Num" Type="String" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="Password" Type="String" />
            <asp:Parameter Name="FName" Type="String" />
            <asp:Parameter Name="LName" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>


    <asp:ObjectDataSource ID="odsPermissions" runat="server" 
    DeleteMethod="QueryDatabase" InsertMethod="QueryDatabase" 
    SelectMethod="QueryDatabase" TypeName="ScreenPermissionsSP" 
    UpdateMethod="QueryDatabase" >
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvPermissionsList" Name="Operation" Type="String" />
            <asp:Parameter Name="MenuID" Type="String" />
            <asp:Parameter Name="UserID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>


    <%--<asp:SqlDataSource runat="server" ID="sdsPermissions" 
            ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
            SelectCommand="SELECT * FROM [MenuTable] WHERE (([ID] &lt;&gt; @ID) AND ([ID] &lt;&gt; @ID2)) ORDER BY [MenuItemOrder]" >
            
            <SelectParameters>
                
                <asp:Parameter DefaultValue="1" Name="ID" Type="Int32" />
                <asp:Parameter DefaultValue="25" Name="ID2" Type="Int32" />
                
            </SelectParameters>

    </asp:SqlDataSource>--%>





</asp:Content>

